#!/bin/bash

#dofileuploadtest requires the following environment variables set. $TESTFILESIZE is probably the only one you need to set
#  $TESTFILESIZE    - Your test definition should set this
#  $HDCFILEBASEPATH - Set by createexperiment (usually called before your test runs)
#  $TESTLABEL       - This is the name of the test (usually set before your test runs - look in runalltests)
#  $TESTFILEPATH    - Set internally by dofileuploadtest
#  $TIMESTAMPEXE    - Set by setupvariables function
#  $DBUSER          - Set by setupvariables function
#  $DBPASSWD        - Set by setupvariables function

function test_1 # This test creates five files of sizes 1, 5, 10, 20 and 100 megabytes
{
  FILESIZES="1 5 10 20 100"
  
  for TESTFILESIZE in $FILESIZES; do
    dofileuploadtest
  done
}

function test_2 # This test creates five files of a random size (<=100 megabytes)
{
  MAXSIZE=100
  DATAFILES=5

  for ((f=1; f<=$DATAFILES; f++)); do
    TESTFILESIZE=$((RANDOM%$MAXSIZE))
    dofileuploadtest
  done
}

function test_3 # This test creates a random number of files (<=100) each 1 megabyte
{
  DATAFILES=$((RANDOM%100))
  TESTFILESIZE=1

  for ((f=1; f<=$DATAFILES; f++)); do
    dofileuploadtest
  done
}

function test_4 # This test creates 100 files each 1 megabyte
{
  DATAFILES=100
  TESTFILESIZE=1
  for ((f=1; f<=$DATAFILES; f++)); do
    dofileuploadtest
  done
}

function test_5 # This test creates 1000 files each 1 megabyte
{
  DATAFILES=1000
  TESTFILESIZE=1
  for ((f=1; f<=$DATAFILES; f++)); do
    dofileuploadtest
  done
}

function test_6 # This test creates 5000 files each 1 megabyte
{
  DATAFILES=5000
  TESTFILESIZE=1
  for ((f=1; f<=$DATAFILES; f++)); do
    dofileuploadtest
  done
}

function test_100000 # This test creates a single file, 100,000 megabytes
{
  TESTFILESIZE=100000
  dofileuploadtest
}

function test_400000 # This test creates a single file, 400,000 megabytes
{
  TESTFILESIZE=400000
  dofileuploadtest
}

function copyonly_5 # This test is an alias for test_5 (creates 1000 files each 1 megabyte)
{
  test_5
}

function copyonly_100000 # This test is an alias for test_100000 (creates a single file, 100,000 megabytes)
{
  test_100000
}

